package minimips.isa.jtype;

import minimips.isa.Instruction;

public abstract class JTypeInstruction extends Instruction {

	private JTypeSpecification properties;
	
	public JTypeInstruction(long memoryAddress, int opcode, String instructionToken, int absoluteAddress) {
		super(memoryAddress, opcode, instructionToken);
		this.properties = new JTypeSpecification(opcode, absoluteAddress);
	}

	@Override
	public int getMachineCode() {
		int machineCode = (getOpcode() << 26) | properties.getAbsoluteAddress();
		return machineCode;
	}

	@Override
	public String toString() {
		return this.getInstructionName() + " " + properties.getAbsoluteAddress();
	}
	
	public int getAbsoluteAddress() {
		return properties.getAbsoluteAddress();
	}
	
}
